package com.authine.cloudpivot.ext.dto.transfer;

import com.authine.cloudpivot.ext.enums.order.transfer.PurchaseRequestEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 采购付款明细
 * Created by xue on 2018/11/9.
 */
@Data
@Schema(description = "PurchaseRequestPaymentDetailDto")
@ApiModel("采购付款明细")
public class PurchaseRequestPaymentDetailDto {
    @Schema(description = "采购付款明细ID")
    private String id;
    @Schema(description = "付款单ID")
    private String payment_id;
    @Schema(description = "采购单ID")
    private String member_purchase_order_id;
    @Schema(description = "付款金额")
    private BigDecimal payment;
    @Schema(description = "付款金额（未）")
    private BigDecimal pre_payment;
    @Schema(description = "付款状态")
    private PurchaseRequestEnum payment_detail_status;
    @Schema(description = "采购员")
    private String buyer;
    /*private String poCode;
    private Double rate;
    private String vendorName;
    private String vendorBank;
    private String accountNumber;
    private String paymentName;
    private String applicantName;
    private PurchaseRequestEnum status;
    private String memo;
    private Date time;*/


    /*public PurchaseRequestPaymentDetailEntity toPurchaseRequestPaymentDetailEntity(PurchaseRequestPaymentDetailDto purchaseRequestPaymentDetailVO) {

        return new PurchaseRequestPaymentDetailEntity(purchaseRequestPaymentDetailVO.getMemberPurchaseOrderId(), purchaseRequestPaymentDetailVO.getPayment(),
                null == purchaseRequestPaymentDetailVO.getInvoiceStatus() ? PurchaseInvoiceEnum.NEW : purchaseRequestPaymentDetailVO.getInvoiceStatus()
                , purchaseRequestPaymentDetailVO.getPrePayment());

    }

    public PurchaseRequestPaymentDetailDto(Integer paymentId, String poCode, Double rate, String vendorName, String vendorBank, String accountNumber, String paymentName, String applicantName, PurchaseRequestEnum status, String memo, Date time, Double payment) {
        this.paymentId = paymentId;
        this.poCode = poCode;
        this.rate = rate;
        this.vendorName = vendorName;
        this.vendorBank = vendorBank;
        this.accountNumber = accountNumber;
        this.paymentName = paymentName;
        this.applicantName = applicantName;
        this.status = status;
        this.memo = memo;
        this.time = time;
        this.payment = payment;
    }

    public static List<PurchaseRequestPaymentDetailDto> toPurchaseRequestPaymentDetailVO(List<PurchaseRequestPaymentDetailEntity> p) {
        List<PurchaseRequestPaymentDetailDto> vo = new ArrayList<>();
        for (PurchaseRequestPaymentDetailEntity s : p) {

            vo.add(new PurchaseRequestPaymentDetailDto(s.getPaymentId(), s.getMemberPurchaseOrder().getPoCode(), s.getMemberPurchaseOrder().getInvoiceRate(),
                    s.getMemberPurchaseOrder().getTransferVendorName(), s.getMemberPurchaseOrder().getTransferVendorBank(), s.getMemberPurchaseOrder().getVendorAccountNumber(),
                    s.getMemberPurchaseOrder().getPaymentName(), s.getApplicantName(), s.getPaymentStatus(), s.getPurchaseRequestPayment().getMemo(), s.getTime(), s.getPayment()));
        }

        return vo;
    }*/
}
